Search


📜 [專欄新文章] Solidity Weekly #14
✍️ mingd...

  • Share this:


📜 [專欄新文章] Solidity Weekly #14
✍️ mingderwang
📥 歡迎投稿: https://medium.com/taipei-ethereum-meetup #徵技術分享文 #使用心得 #教學文 #medium

如何使用 ZeppelinOS 產生 ERC20 tokens

本期不寫 Code

讓我們在 Ropsten Test net 上測試,用 ZeppelinOS 直接產生 ERC20 tokens。

先安裝與架設好 zos for Rosten network deployment:

cd /tmp && mkdir my-app && cd my-appnpm install yarn zoszos init my-app 1.0.0zos link openzeppelin-zos

rm truffle-config.js && wget https://gist.githubusercontent.com/…/1be8…/truffle-config.js

yarn add openzeppelin-zos truffle-hdwallet-providerzos push --network ropsten

然後執行以下指令,假設你在 Ropsten 有一個帳號 ,例如這裡的 0x66ee73086134f147745be72335153bf780499e2e,當成這 tokens 合約的所有人,您可更改 muzha 成你要的 token 名稱,以及改 MUZA 成你要的 token 符號。

只要一行指令, 就可以生成 tokens:

在 /tmp/my-app 目錄下

OWNER=0x66ee73086134f147745be72335153bf780499e2e zos create DetailedPremintedToken --init initialize --args $OWNER,muzha,MUZA,8,100000000000000000000 --network ropsten

結果如下,就可以產生一兆個 ERC20 tokens,合約位址在 0xc634d06c9d0fac3c6b341dc6238a15f253caecf9

Creating DetailedPremintedToken proxy and calling initialize with: - _sender (address): "0x66ee73086134f147745be72335153bf780499e2e" - _name (string): "muzha" - _symbol (string): "MUZA" - _decimals (uint8): "8" - _initialBalance (uint256): "100000000000000000000" TX receipt received: 0x6aa11e9a8465092ee17642703aeec1272e1dda452a028da1f460bbcd75dac6d8 DetailedPremintedToken proxy: 0xc634d06c9d0fac3c6b341dc6238a15f253caecf9Successfully written zos.ropsten.json

可以利用 Ropsten 的 Etherscan 做驗證如下:
https://ropsten.etherscan.io/tokens…
LT;DR

安裝 zos 與 truffle 這麼麻煩,乾脆用 docker,結果是一樣的:

docker run mingder78/create-erc20-token 0x66ee73086134f147745be72335153bf780499e2e,TaiwanNewToken,TNT,8,100000000000000000000

$ docker run mingder78/create-erc20-token 0x66ee73086134f147745be72335153bf780499e2e,TaiwanNewToken,TNT,8,100000000000000000000Creating DetailedPremintedToken proxy and calling initialize with: — _sender (address): “0x66ee73086134f147745be72335153bf780499e2e” — _name (string): “TaiwanNewToken” — _symbol (string): “TNT” — _decimals (uint8): “8” — _initialBalance (uint256): “100000000000000000000” TX receipt received: 0xfa424db886ea3bcdfa79bed262c41b82b2a028dfdc240bfb47e067ae34ae4aa6 DetailedPremintedToken proxy: 0x5e19e1830d452e64157c3a49978607f02d79bbf8Successfully written zos.ropsten.json0x5e19e1830d452e64157c3a49978607f02d79bbf8
https://ropsten.etherscan.io/tokens…
參考資料

Docker Hub for mingder78/create-erc20-token

計畫來源: https://github.com/EtherTW/tokensandbox.io

Solidity Weekly #14 was originally published in Taipei Ethereum Meetup on Medium, where people are continuing the conversation by highlighting and responding to this story.

👏 歡迎轉載分享鼓掌


Tags:

About author
not provided
We have regular meeting twice per month on discussing blockchain technology, smart contracts and DApps development! We would love to have you join us!
View all posts